import random
import turtle

def star():
    # 清空
    turtle.clear()
    a = random.randint(0, 255)
    b = random.randint(0, 255)
    c = random.randint(0, 255)
    turtle.colormode(255)
    turtle.fillcolor(a, b, c)
    turtle.begin_fill()
    for i in range(5):
        turtle.fd(100)
        turtle.rt(144)
    turtle.end_fill()
    # 定时1000毫秒，执行一次star函数
    turtle.ontimer(star, 1000)
# 去除动画效果
turtle.tracer(False)
star()
turtle.done()